#include "block.h"

#include <iostream>

#include "player.h"

std::vector<sf::Image> Block::m_images;

void Block::LoadTextures()
{
    std::string path("media/textures/");
    std::string textures[] = { "wall.png", "nitro.png", "removable.png" };

    m_images.resize(sizeof textures / sizeof *textures + 1);

    for (int i = 0; i < (sizeof textures / sizeof *textures); ++i)
        m_images[i+1].LoadFromFile(path + textures[i]);
}

Block::Block(void) :
    sf::Sprite()
{
}

Block::~Block(void)
{
}

void Block::action(Player &player)
{
    switch (type()) {
        case Wall:
            player.goUpward();
            break;

        default:;
    }
    //if ( m_Map->GetBlock(id.x, id.y) == BLOCK_WALL )
	//{
	//	// Collision verticale
	//	if (m_Pos.y - m_PrevPos.y > 0) // Si on tombe sur un bloc
	//	{
	//		m_Speed.y *= -1;
	//	}
	//}
	//else if ( m_Map->GetBlock(id.x, id.y) == BLOCK_NITRO )
	//{
	//	m_Map->Reset ();
	//	Reset ();
	//}
	//else if ( m_Map->GetBlock(id.x, id.y) == BLOCK_REMOVABLE )
	//{
	//	if (m_Pos.y - m_PrevPos.y > 0) // Si on tombe sur un bloc
	//	{
	//		m_Speed.y *= -1;
	//		m_Map->SetBlock (id.x, id.y, BLOCK_NOTHING);
	//	}
	//}
}